package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Name     string `gorm:"type:varchar(15);not null;comment:用户名"`
	Tel      string `gorm:"type:char(11);not null;comment:手机号"`
	Password string `gorm:"type:char(32);comment:密码"`
	AddTime  string `gorm:"type:varchar(200);not null;comment:注册时间"`
	UserType int    `gorm:"type:tinyint;not null;comment:用户状态 1.正常 2.冻结"`
}

func (u *User) UserInfo(Tel string) error {
	return DB.Where("tel = ?", Tel).Limit(1).Find(&u).Error
}

func (u *User) UserInfoId(UserId int64) error {
	return DB.Where("id = ?", UserId).Limit(1).Find(&u).Error
}
